#ifndef __DISPLAY_H
#define __DISPLAY_H

#define GFX_ADDR			0x3CE
#define GFX_DATA			0x3CF
#define GFX_I_RESET		0x00
#define GFX_I_ENABLE		0x01
#define GFX_I_COLORCMP	0x02
#define GFX_I_ROTATE		0x03
#define GFX_I_READMAP	0x04
#define GFX_I_MODE		0x05
#define GFX_I_MISC		0x06
#define GFX_I_CNOCARE	0x07
#define GFX_I_BITMASK	0x08

#define SEQ_ADDR 			0x3C4
#define SEQ_DATA 			0x3C5
#define SEQ_I_RESET 		0x00
#define SEQ_I_CLOCK 		0x01
#define SEQ_I_MAPMASK 	0x02
#define SEQ_I_CHARMAP	0x03
#define SEQ_I_MEMMODE	0x04

#define ATR_ADDR_DATA	0x3C0
#define ATR_DATA_READ	0x3C1

#define CRT_ADDR					0x3D4
#define CRT_DATA					0x3D5
#define CRT_I_H_TOTAL			0x00
#define CRT_I_END_H_DIS 		0x01
#define CRT_I_START_H_BLANK 	0x02
#define CRT_I_END_H_BALNK	 	0x03
#define CRT_I_START_H_RET 		0x04
#define CRT_I_END_H_RET 		0x05
#define CRT_I_V_TOTAL 			0x06
#define CRT_I_OVERFLOW 			0x07
#define CRT_I_PRE_ROW_SCN	 	0x08
#define CRT_I_MAX_SCN_LINE 	0x09
#define CRT_I_START_CUR 		0x0A
#define CRT_I_END_CUR 			0x0B
#define CRT_I_START_ADDR_H 	0x0C
#define CRT_I_START_ADDR_L 	0x0D
#define CRT_I_CUR_LOC_H 		0x0E
#define CRT_I_CUR_LOC_L 		0x0F
#define CRT_I_START_V_RET 		0x10
#define CRT_I_END_V_RET 		0x11
#define CRT_I_END_V_DIS 		0x12
#define CRT_I_OFFSET 			0x13
#define CRT_I_UND_LOC 			0x14
#define CRT_I_START_V_BLANK 	0x15
#define CRT_I_END_V_BLANK 		0x16
#define CRT_I_MODE 				0x17
#define CRT_I_LINE_CMP 			0x18

#define DAC_ADDR_W		0x3C8
#define DAC_ADDR_R		0x3C7
#define DAC_DATA			0x3C9
#define DAC_STATE			0x3C7

#define VGA_MISC_W		0x3C2
#define VGA_MISC_R		0x3CC
#define VGA_FEATURE_W	0x3DA
#define VGA_FEATURE_R	0x3CA
#define VGA_STATUS_0		0x3C2
#define VGA_STATUS_1		0x3DA

#define VGA_BLACK				0
#define VGA_BLUE				1
#define VGA_GREEN				2
#define VGA_CYAN				3
#define VGA_RED				4
#define VGA_MAGENTA			5
#define VGA_BROWN				6
#define VGA_GREY_LIGHT		7
#define VGA_GREY_DARK		8
#define VGA_BLUE_LIGHT		9
#define VGA_GREEN_LIGHT		10
#define VGA_CYAN_LIGHT		11
#define VGA_RED_LIGHT		12
#define VGA_MAGENTA_LIGHT	13
#define VGA_BROWN_LIGHT		14
#define VGA_WHITE				15

void clear_screen(void);

void write_char(u8int c);
void poke_s8int(u8int c);

void write_string(s8int *str);

void write_number(u32int num);
void write_hex(u32int num);

void settextcolor(u8int forecolor, u8int backcolor);

void set_cursor(u32int x, u32int y);
void set_pointer(u32int x, u32int y);
u32int get_cursor_x(void);
u32int get_cursor_y(void);
u32int get_pointer_x(void);
u32int get_pointer_y(void);
void update_cursor(void);

void init_video_interface(void);
void init_video(void);
void set80x60(void);

void enable_scroll(void);
void disable_scroll(void);

u32int csr_x, csr_y, ptr_x, ptr_y;
#endif
